package com.crazyhat.crazyhat.entity;

import java.io.Serializable;
import java.time.LocalDateTime;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.crazyhat.crazyhat.anno.SensitiveWordAnno;
import com.fasterxml.jackson.annotation.JsonFormat;

import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Getter;
import lombok.Setter;

/**
 * <p>
 * 评论
 * </p>
 *
 * @author crazyhat
 * @since 2024-07-05
 */
@Getter
@Setter
@TableName("comment")
public class Comment implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 评论ID
     */
    @TableId(value = "comment_id",type = IdType.AUTO)
    private Integer commentId;

    /**
     * 所属的动态ID
     */
    @NotNull
    @TableField("post_id")
    private Integer postId;

    /**
     * 评论者ID
     */
    @TableField("commentator_id")
    private Integer commentatorId;

    /**
     * 评论时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField("comment_time")
    private LocalDateTime commentTime;

    /**
     * 评论内容
     */
    @SensitiveWordAnno
    @NotEmpty
    @TableField("comment_content")
    private String commentContent;

    /**
     * 回复的评论ID
     */
    @TableField("replyed_comment_id")
    private Integer replyedCommentId;
}
